import { ipcRenderer } from "electron";
export function sendOpenFlyCar(){
    ipcRenderer.send('openFlyCar')
}
export function sendMessage(data:string){
    ipcRenderer.send('message',data)
}
//同步通信测试
export function eventOnTest() {
  const result = ipcRenderer.sendSync("event-on-test", "哈哈来了");
  console.log(result);
}

// 异步通信测试
export function eventHandleTest() {
  ipcRenderer.invoke("event-handle-test", "你好").then((res) => {
    console.log(res);
  });
}

// 异步通信一次
export function eventHandleOnceTest() {
  ipcRenderer.invoke("event-handleOnce-test");
}

// 测试windows 的动态库

export function sumTwo(a:number,b:number){
  ipcRenderer.invoke("sum",a,b).then((res)=>{
    console.log(res)
  })
}

export default {
    sendOpenFlyCar,
    sendMessage,
    eventOnTest,
    eventHandleTest,
    eventHandleOnceTest,
    sumTwo
};